﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Company.Master" AutoEventWireup="true"
    CodeBehind="CompanyMail.aspx.cs" Inherits="E_Shop.CompanyMail" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Assembly="ESHOP.Controls" Namespace="EBAYVN.Controls" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        #tabs
        {
            position: absolute;
            width: 64%;
            margin-left: auto;
            margin-right: auto;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#tabs").tabs();
        });
        $(document).ready(function () {
            if ($("#detailsmail") != null) {
                $("#detailsmail").dialog({
                    autoOpen: false,
                    modal: true,
                    minHeight: 100,
                    height: 'auto',
                    width: 'auto',
                    draggable: true,
                    resizable: false,
                    open: function () {
                        $(this).parent().appendTo($("form:first"));
                    }
                });
            }
            if ($("#replyemail") != null) {
                $("#replyemail").dialog({
                    autoOpen: false,
                    modal: true,
                    minHeight: 100,
                    height: 'auto',
                    width: 'auto',
                    draggable: true,
                    resizable: false,
                    open: function () {
                        $(this).parent().appendTo($("form:first"));
                    }
                });
            }
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="divLoading" style="display: none">
        <div class="divLoadingContent">
            <img src="<%= ResolveUrl("~") %>content/images/loading.gif" alt="Đang tải dữ liệu..." />
            <br />
            <span>Đang tải dữ liệu...</span>
        </div>
    </div>
    <div id="detailsmail" style="display: none">
        <asp:UpdatePanel ID="updetailsmail" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <rsweb:ReportViewer ID="rpViewer" runat="server" Width="600px">
                </rsweb:ReportViewer>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <div id="replyemail" style="display: none">
        <asp:UpdatePanel ID="Upreplyemail" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <table style="border: 1px solid #0883cc">
                    <tr style="border-bottom: 1px  solid #0883cc; margin-top: 10px">
                        <td style="border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #0883cc">
                            <asp:Label ID="lbnguoigui" runat="server" Text="Recevier :" Font-Bold="true"></asp:Label>
                            <asp:Label ID="lbreceiver" runat="server" Text=""></asp:Label>
                        </td>
                        <td style="border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #0883cc">
                            <asp:Label ID="Label1" runat="server" Text="Datetime: " Font-Bold="true"></asp:Label>
                            <asp:Label ID="lbngaygui" runat="server" Text=""></asp:Label>
                        </td>
                    </tr>
                    <tr style="margin-top: 10px">
                        <td colspan="2" style="border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #0883cc">
                            <asp:Label ID="Label2" runat="server" Text="Subject : " Font-Bold="true"></asp:Label>
                            <asp:TextBox ID="txtSubject" runat="server" Text="" Width="300px" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr style="margin-top: 10px">
                        <td colspan="2" style="border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #0883cc">
                            <asp:Label ID="Label3" runat="server" Text="Content Message :" Font-Bold="true"></asp:Label>
                    </tr>
                    <tr style="margin-top: 10px">
                        <td colspan="2" style="border-bottom-style: solid; border-bottom-width: thin; border-bottom-color: #0883cc">
                            <asp:TextBox ID="txtcontent" runat="server" TextMode="MultiLine" Width="500px"></asp:TextBox>
                        </td>
                    </tr>
                    <tr style="margin-top: 10px">
                        <td colspan="2" style="text-align: center">
                            <asp:Button ID="btnsend" runat="server" Text="Send" OnClick="btnsend_Click" />
                        </td>
                    </tr>
                </table>
                <br />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <form id="frmMail" action="Companydefault.aspx">
    <div id="tabs">
        <ul>
            <li><a href="#tabs-1">Inbox</a></li>
            <li><a href="#tabs-2">Outbox</a></li>
            <li><a href="#tabs-3">Deletebox</a></li>
        </ul>
        <div id="tabs-1">
            <div style="width: 100%" class="stuff3">
                <div id="MtorightArea" class="clearfx fl" style="width: 100%">
                    <!--curTitle-->
                    <div class="blue-left">
                        New Email</div>
                    <div class="blue-right">
                        <a class="close-blue">
                            <img src="Images/Shared/icon_close_blue.gif" alt="" /></a>
                    </div>
                    <br />
                    <!--//curTitle end-->
                    <input type="hidden" name="cmd" value="showList" />
                    <input type="hidden" name="mode" value="INB" />
                    <input type="hidden" name="CurPage" value="1" />
                    <asp:UpdatePanel ID="UpGrid" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <cc1:Grid runat="server" UseCustomPager="false" PageSize="10" ID="gvListEmail" CssClass="grid"
                                OnRowCommand="gvListSP_RowCommand" OnRowDataBound="gvListEmail_RowDataBound"
                                AllowSorting="True" OnPageIndexChanging="gvListEmail_PageIndexChanging">
                                <PagerSettings FirstPageText="sản phẩm" PageButtonCount="2" />
                                <Columns>
                                    <asp:TemplateField HeaderStyle-CssClass="checkbox" HeaderStyle-Width="15%" HeaderText="#">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <ItemStyle Width="5%" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Sender" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.TENCONGTY") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Subject">
                                        <ItemTemplate>
                                            <%# Eval("SUBJECT").ToString().Length>15?Eval("SUBJECT").ToString().Substring(0,15)+"...":
                                    Eval("SUBJECT").ToString()
                                            %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                   
                                    <asp:TemplateField HeaderText="Region" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.QUOCGIA.TENQUOCGIA") %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Date" HeaderStyle-Width="8%">
                                        <ItemTemplate>
                                            <%# (Eval("NGAYGUI") != null) ?
                                        String.Format("{0:dd/MM/yyyy}", Eval("NGAYGUI"))
                                        : "" %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Options" HeaderStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="linkDelete" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="deleteemail" CssClass="link" Text='<%# Eval("ISSHOW").ToString().Equals("True")?"Delete":"Active" %>' />
                                            <asp:LinkButton ID="linkDetails" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="detailsmail" CssClass="link" Text="details" OnClientClick="openDialogAndBlock('Content email', 600, 'detailsmail')" />
                                            <asp:LinkButton ID="linkreply_email" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="replyemail" CssClass="link" Text="Reply" OnClientClick="openDialogAndBlock('Reply email', 600, 'replyemail')" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </cc1:Grid>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <div class="pagenav">
                    </div>
                    <!--curTitle-->
                    <div class="blue-left">
                        Old Email</div>
                    <div class="blue-right">
                        <a class="close-blue">
                            <img src="Images/Shared/icon_close_blue.gif" alt="" /></a>
                    </div>
                    <br />
                    <asp:UpdatePanel ID="Upgridreadinbox" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <cc1:Grid runat="server" UseCustomPager="false" PageSize="10" ID="Gvlist_inbox_read"
                                CssClass="grid" OnRowCommand="Gvlist_inbox_read_RowCommand" OnRowDataBound="Gvlist_inbox_read_RowDataBound"
                                AllowSorting="True" OnPageIndexChanging="Gvlist_inbox_read_PageIndexChanging">
                                <PagerSettings FirstPageText="sản phẩm" PageButtonCount="2" />
                                <Columns>
                                    <asp:TemplateField HeaderStyle-CssClass="checkbox" HeaderStyle-Width="15%" HeaderText="#">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <ItemStyle Width="5%" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Sender" HeaderStyle-Width="20%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.TENCONGTY") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Subject">
                                        <ItemTemplate>
                                            <%# Eval("SUBJECT").ToString().Length>15?Eval("SUBJECT").ToString().Substring(0,15)+"...":
                                    Eval("SUBJECT").ToString()
                                            %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                 
                                    <asp:TemplateField HeaderText="Region" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.QUOCGIA.TENQUOCGIA") %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Date" HeaderStyle-Width="8%">
                                        <ItemTemplate>
                                            <%# (Eval("NGAYGUI") != null) ?
                                        String.Format("{0:dd/MM/yyyy}", Eval("NGAYGUI"))
                                        : "" %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Options" HeaderStyle-Width="15%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="linkDelete" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="deleteemail" CssClass="link" Text='<%# Eval("ISSHOW").ToString().Equals("True")?"Delete":"Active" %>' />
                                            <asp:LinkButton ID="linkDetails" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="detailsmail" CssClass="link" Text="details" OnClientClick="openDialogAndBlock('Content email', 800, 'detailsmail')" />
                                            <asp:LinkButton ID="linkreply_email" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="replyemail" CssClass="link" Text="Reply" OnClientClick="openDialogAndBlock('Reply email', 600, 'replyemail')" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </cc1:Grid>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </div>
        </div>
        <div id="tabs-2">
            <div style="width: 100%" class="stuff3">
                <div id="Div1" class="clearfx fl" style="width: 100%">
                    <!--curTitle-->
                    <div class="blue-left">
                        New Email</div>
                    <div class="blue-right">
                        <a class="close-blue">
                            <img src="Images/Shared/icon_close_blue.gif" alt="" /></a>
                    </div>
                    <br />
                    <!--//curTitle end-->
                    <input type="hidden" name="cmd" value="showList" />
                    <input type="hidden" name="mode" value="INB" />
                    <input type="hidden" name="CurPage" value="1" />
                    <asp:UpdatePanel ID="Upgirdoutbox" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <cc1:Grid runat="server" UseCustomPager="false" PageSize="10" ID="gvoutbox" CssClass="grid"
                                OnRowCommand="gvoutbox_RowCommand" OnRowDataBound="gvoutbox_RowDataBound"
                                AllowSorting="True" OnPageIndexChanging="gvoutbox_PageIndexChanging">
                                <PagerSettings FirstPageText="sản phẩm" PageButtonCount="2" />
                                <Columns>
                                    <asp:TemplateField HeaderStyle-CssClass="checkbox" HeaderStyle-Width="15%" HeaderText="#">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <ItemStyle Width="5%" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Sender" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.TENCONGTY") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Subject">
                                        <ItemTemplate>
                                            <%# Eval("SUBJECT").ToString().Length>15?Eval("SUBJECT").ToString().Substring(0,15)+"...":
                                    Eval("SUBJECT").ToString()
                                            %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Region" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.QUOCGIA.TENQUOCGIA") %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Date" HeaderStyle-Width="8%">
                                        <ItemTemplate>
                                            <%# (Eval("NGAYGUI") != null) ?
                                        String.Format("{0:dd/MM/yyyy}", Eval("NGAYGUI"))
                                        : "" %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Options" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <asp:LinkButton ID="linkDelete" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="deleteemail" CssClass="link" Text='<%# Eval("ISSHOW").ToString().Equals("True")?"Delete":"Active" %>' />
                                            <asp:LinkButton ID="linkDetails" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="detailsmail" CssClass="link" Text="details" OnClientClick="openDialogAndBlock('Content email', 600, 'detailsmail')" />
                                           
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </cc1:Grid>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <div class="pagenav">
                    </div>
                   
                </div>
            </div>
        </div>
        <div id="tabs-3">
            <div style="width: 100%" class="stuff3">
                <div id="Div2" class="clearfx fl" style="width: 100%">
                    <!--curTitle-->
                    <div class="blue-left">
                        Delete Email</div>
                    <div class="blue-right">
                        <a class="close-blue">
                            <img src="Images/Shared/icon_close_blue.gif" alt="" /></a>
                    </div>
                    <br />
                    <!--//curTitle end-->
                    <input type="hidden" name="cmd" value="showList" />
                    <input type="hidden" name="mode" value="INB" />
                    <input type="hidden" name="CurPage" value="1" />
                    <asp:UpdatePanel ID="upGirddelete" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <cc1:Grid runat="server" UseCustomPager="false" PageSize="10" ID="Gvdelete" CssClass="grid"
                                OnRowCommand="Gvdelete_RowCommand" OnRowDataBound="Gvdelete_RowDataBound"
                                AllowSorting="True" OnPageIndexChanging="Gvdelete_PageIndexChanging">
                                <PagerSettings FirstPageText="sản phẩm" PageButtonCount="2" />
                                <Columns>
                                    <asp:TemplateField HeaderStyle-CssClass="checkbox" HeaderStyle-Width="15%" HeaderText="#">
                                        <ItemTemplate>
                                            <%# Container.DataItemIndex + 1 %>
                                        </ItemTemplate>
                                        <ItemStyle Width="5%" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Sender" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.TENCONGTY") %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Subject">
                                        <ItemTemplate>
                                            <%# Eval("SUBJECT").ToString().Length>15?Eval("SUBJECT").ToString().Substring(0,15)+"...":
                                    Eval("SUBJECT").ToString()
                                            %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    
                                    <asp:TemplateField HeaderText="Region" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                            <%# Eval("CONGTY.QUOCGIA.TENQUOCGIA") %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Date" HeaderStyle-Width="8%">
                                        <ItemTemplate>
                                            <%# (Eval("NGAYGUI") != null) ?
                                        String.Format("{0:dd/MM/yyyy}", Eval("NGAYGUI"))
                                        : "" %>
                                        </ItemTemplate>
                                        <ItemStyle Font-Bold="true" ForeColor="Black" HorizontalAlign="Right" />
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Options" HeaderStyle-Width="10%">
                                        <ItemTemplate>
                                           
                                            <asp:LinkButton ID="linkDetails" runat="server" CommandArgument='<%# Eval("ID") %>'
                                                CommandName="detailsmail" CssClass="link" Text="details" OnClientClick="openDialogAndBlock('Content email', 600, 'detailsmail')" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </cc1:Grid>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                    <div class="pagenav">
                    </div>
                   
                </div>
            </div>
        </div>
    </div>
    </form>
</asp:Content>
